using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class CustomerPanel : MonoBehaviour
{
    public InputField m_IFxLen;
    public InputField m_IFyLen;
    public InputField m_IFmineCount;
    public Button m_BtnConfirm;
    public Button m_BtnCancel;

    public void Show()
    {
        gameObject.SetActive(true);
    }

    public void Hide()
    {
        gameObject.SetActive(false);
    }

    //=========================================公私分界线==================================================

    void Awake()
    {
        gameObject.SetActive(false);
        m_BtnConfirm.onClick.AddListener(OnBtnConfirmClick);
        m_BtnCancel.onClick.AddListener(OnBtnCancelClick);
    }

    void OnBtnConfirmClick()
    {
        if (string.IsNullOrEmpty(m_IFxLen.text)) return;
        if (string.IsNullOrEmpty(m_IFyLen.text)) return;
        if (string.IsNullOrEmpty(m_IFmineCount.text)) return;

        GameMode.Instance.Init(EGameMode.Customer, int.Parse(m_IFxLen.text), int.Parse(m_IFyLen.text), int.Parse(m_IFmineCount.text));
        SceneManager.LoadSceneAsync("GamePlay", LoadSceneMode.Single);
    }

    void OnBtnCancelClick()
    {
        gameObject.SetActive(false);
    }
}
